﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace Shared
{
    public static class Tick
    {
        #region Interop

        [DllImport("kernel32.dll")]
        public static extern int GetTickCount();

        #endregion

        #region Methods

        /// <summary>
        /// Converts regular tick-time to client tick-time.
        /// </summary>
        /// <param name="Time">Regular tick-time.</param>
        /// <returns>Client tick-time.</returns>
        public static ulong ToClientTime(uint Time)
        {
            return Time * 1000;
        }

        /// <summary>
        /// Converts client tick-time to regular tick-time.
        /// </summary>
        /// <param name="ClientTime">Client tick-time.</param>
        /// <returns>Regular tick-time.</returns>
        public static uint FromClientTime(ulong ClientTime)
        {
            return (uint)(ClientTime / 1000);
        }

        #endregion
    }
}
